<?php

use Illuminate\Routing\Router;

Admin::registerAuthRoutes();

Route::group([
    'prefix'        => config('admin.route.prefix'),
    'namespace'     => config('admin.route.namespace'),
    'middleware'    => config('admin.route.middleware'),
], function (Router $router) {

    $router->get('/', 'HomeController@index')->name('admin.home');
    
    $router->get('miniprograminfo/{id}/edit', 'MiniProgramInfoController@edit');
    $router->put('miniprograminfo/{id}', 'MiniProgramInfoController@update');
    $router->get('miniprograminfo/{order}', 'MiniProgramInfoController@show');
    $router->resource('miniprogrammodules',MiniProgramModuleSettingsController::class);

    $router->resource('users',UsersController::class);
    // 轮播图
    $router->get('banners', 'BannersController@index');
    $router->get('banners/create', 'BannersController@create');
    $router->get('banners/{id}/edit', 'BannersController@edit');
    $router->post('banners', 'BannersController@store');
    $router->put('banners/{id}', 'BannersController@update');
    $router->delete('banners/{id}', 'BannersController@destroy');
    // $router->resource('banners',BannersController::class);
    // 品牌图片
    $router->get('photo_shows', 'PhotoShowsController@index');
    $router->get('photo_shows/create', 'PhotoShowsController@create');
    $router->get('photo_shows/{id}/edit', 'PhotoShowsController@edit');
    $router->post('photo_shows', 'PhotoShowsController@store');
    $router->put('photo_shows/{id}', 'PhotoShowsController@update');
    $router->delete('photo_shows/{id}', 'PhotoShowsController@destroy');
    // $router->resource('brands',BrandsController::class);
    //产品类别
    // $router->get('categories', 'CategoriesController@index');
    // $router->get('categories/create', 'CategoriesController@create');
    // $router->get('categories/{id}/edit', 'CategoriesController@edit');
    // $router->post('categories', 'CategoriesController@store');
    // $router->put('categories/{id}', 'CategoriesController@update');
    // $router->delete('categories/{id}', 'CategoriesController@destroy');

    $router->get('products', 'ProductsController@index');
    $router->get('products/create', 'ProductsController@create');
    $router->get('products/{id}/edit', 'ProductsController@edit');
    $router->post('products', 'ProductsController@store');
    $router->put('products/{id}', 'ProductsController@update');
    $router->delete('products/{id}', 'ProductsController@destroy');

    $router->get('product_skus', 'ProductSkusController@index');
    $router->get('product_skus/create', 'ProductSkusController@create');
    $router->get('product_skus/{id}/edit', 'ProductSkusController@edit');
    $router->post('product_skus', 'ProductSkusController@store');
    $router->put('product_skus/{id}', 'ProductSkusController@update');
    $router->delete('product_skus/{id}', 'ProductSkusController@destroy');
    $router->get('product_skus/edit_sku', 'ProductSkusController@editSku');
    $router->post('product_skus/edit_sku', 'ProductSkusController@store');

    $router->resource('categories',CategoriesController::class);
    $router->get('api/categories', 'CategoriesController@apiIndex')->name('api.getcategories');

    // $router->get('products/{id}/edit_sku', 'ProductsController@editSku')->name('admin.editsku');
    // $router->post('products/{id}/edit_sku', 'ProductsController@saveSkuSpec');
    // $router->resource('products',ProductsController::class);
    // $router->resource('product_skus',ProductSkusController::class);
    $router->resource('specifications',SpecificationsController::class);
    $router->resource('specification_items',SpecificationItemsController::class);
    $router->resource('colors',AttributeColorsController::class);
    $router->resource('sizes',AttributeSizesController::class);

    $router->get('orders', 'OrdersController@index')->name('admin.orders.index');
    $router->get('orders/{order}', 'OrdersController@show')->name('admin.orders.show');
    $router->post('orders/{order}/ship', 'OrdersController@ship')->name('admin.orders.ship');
    $router->post('orders/{order}/refund', 'OrdersController@handleRefund')->name('admin.orders.handle_refund');
});
